package main

import "fmt"

// Author : CSR丶WARRIOR
// Time ： 2020/10/15  10:08
// TOOLS : GoLand
// FILENAME : slicePointer.go
// STATEMENT: 切片指针

func main() {
	var s = make([]int, 0)
	s = append(s, 1)
	s = append(s, 2)
	s = append(s, 3)
	slicePointer(&s)
	fmt.Println(s) //[12 2 3]
}

func slicePointer(p *[]int) {
	for _, v := range *p {
		fmt.Printf("%d\t", v) //1	2	3
	}
	//修改切片中的值
	(*p)[0] = 12
}
